<% layout('/views/layouts/default.html', {title: 'UserInfo-新增', libs: ['validate']}){ %>
<div class="content-wrapper">
	<section class="content-header">
		<h1>用户信息<small>新增</small></h1>
	</section>

	<section class="content">
		<div class="row">
			<div class="col-md-6">
				<div class="box box-primary">
					<div class="box-header with-border">
						<!--<h3 class="box-title">Quick Example</h3>-->
					</div>
					<form id="myForm" role="form" action="/user/add">
						<div class="box-body">
							<div class="form-group">
								<label>用户名</label>
								<input type="text" name="username" class="form-control" id="username" placeholder="Enter 用户名">
							</div>
							<div class="form-group">
								<label>密码</label>
								<input type="text" name="password" class="form-control" id="password" placeholder="Enter 密码">
							</div>
							<div class="form-group">
								<label>真实姓名</label>
								<input type="text" name="realName" class="form-control" id="realName" placeholder="Enter 密码">
							</div>
							<div class="form-group">
								<label>状态</label>
								<input type="text" name="state" class="form-control" id="state" placeholder="Enter 状态1：正常，0：冻结" value="1">
							</div>
						</div>

						<div class="box-footer">
							 <button id="myButton" type="button" class="btn btn-primary">Submit - 提交</button>&nbsp;&nbsp;
							<a href="/user/listPage"><button id="backButton" type="button" class="btn btn-default">返 回</button></a>

							<div id="msgDiv" style="float:right;margin-top:7px;color:red;"></div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</section>
</div>

<% } %>
<script>
	$("#myButton").click(function(){
		$("#myForm").ajaxSubmit({
			success: function (data) {
				if (data.resCode == 1){
					$("#msgDiv").text(data.resMsg);
				}
			},
			error: function () {
				$("#msgDiv").text("系统出现错误，请联系管理员");
			}
		});
	});
document.body.style.backgroundColor = '#ECF0F5';
</script>
